/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nc.kyiv.yellow.sociallibrary.ConnectionPool;

import java.util.Locale;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

/**
 *
 * @author My
 */
public class ConnectionPool {
    
    private static DataSource connectionPool;
    
    private ConnectionPool() {    
    }

    public static synchronized DataSource getConnectionPool() {
        if (connectionPool == null) {
            try {
                Context ic = new InitialContext();
                Locale.setDefault(Locale.ENGLISH);
                connectionPool = (DataSource) ic.lookup("jdbc/sociallibraryConnection");
            } catch (NamingException ex) {
            }
        }
        return connectionPool;
    }
}
